<?php

namespace app\common\model;

use app\api\model\xykeep\User;
use think\Model;


class Card extends Model
{

    

    

    // 表名
    protected $name = 'card';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
    ];





    public function getContentTextAttr($value, $data)
    {
        if($data['id']==1){
            return $this->v1();
        }elseif ($data['id']==2){
            return $this->v2();
        }elseif ($data['id']==3){
            return $this->v3();
        }
        return $this->v3();
    }

    //是否被购买
    public function buyed()
    {
        $user = User::info();
        if($user){
            $user_id = $user->id;
        }else{
            $user_id = 0;
        }
        return $this->belongsTo('app\common\model\UserCard', 'id','card_id')->bind('nums,overtime')->where([
            'user_id' => $user_id,
        ])->setEagerlyType(1);
    }


    public function v3(){
        $data = [];
        $data['root_tit'] = '会员尊享权益';
        $data['root_desc'] = 'service privileges';
        $data['root_menu'] = [
            [
                'title' => '生日礼遇',
                'icon' => '/static/images/benfit/card-birthday.png',
            ],
            [
                'title' => '积分权益',
                'icon' => '/static/images/benfit/card-integral.png',
            ],
            [
                'title' => '专属活动',
                'icon' => '/static/images/benfit/card-activity.png',
            ],
            [
                'title' => '专属客服',
                'icon' => '/static/images/benfit/card-service.png',
            ]
        ];
        $data['service_tit'] = '两重专属服务特权';
        $data['service_desc'] = 'service privileges';

        $data['service_full'] = [
            [
                'crumb' => '教育特权',
                'image' => '/static/images/benfit/root-1.png',
                'title' => '三大课程200节教育体系',
                'desc' => '美育训练营（美术、音乐、形体等） 体适能：健康护航（体能、武术、心理等） 拓展园地（国学、硬笔、语训等）',
                'value' => '价值10000元',
                'bgcolor' => 'background:linear-gradient(to bottom,#95e3e2,#5bcdc6);'
            ],
        ];
        $data['service_half'] = [
            [
                'crumb' => '医疗绿通',
                'image' => '/static/images/benfit/root-2.png',
                'title' => '专家一对一问诊',
                'desc' => '全国3000多个三甲医院绿通  1次,上海博士团视频问诊    1次',
                'value' => '价值20000元',
                'bgcolor' => 'background:linear-gradient(to bottom,#74be5b,#a7d392);'
            ],
            [
                'crumb' => '旅游特权',
                'image' => '/static/images/benfit/root-3.png',
                'title' => '心之所至 旅游好礼',
                'desc' => '门票一卡通,西河一大一小',
                'value' => '价值188元',
                'bgcolor' => 'background:linear-gradient(to bottom,#95e3e2,#5bcdc6);'
            ],
            [
                'crumb' => '生活特权',
                'image' => '/static/images/benfit/root-4.png',
                'title' => '贴心守护生活',
                'desc' => '线上折扣卡',
                'value' => '价值5000元',
                'bgcolor' => 'background: linear-gradient(to bottom,#88aad9,#8c99cc)'
            ],
            [
                'crumb' => '其他特权',
                'image' => '/static/images/benfit/root-5.png',
                'title' => '丰富特权唯你专享',
                'desc' => 'es6一天驾驶权,小米背包',
                'value' => '价值499元',
                'bgcolor' => 'background: linear-gradient(to bottom,#65c6da,#7ccef2)'
            ]
        ];

        $data['goods_tit'] = '商家精选福利';
        $data['goods_desc'] = 'SELECTED BENEFITS';

        $data['goods'] = [
            [
                'image' => '/static/images/benfit/wcj.png',
                'title' => '翁财记(福气满堂礼盒)',
                'desc' => '主要包含不同口味、规格的瓜子、蚕豆酥等炒货系列。',
                'value' => '价值¥268元',
            ],
            [
                'image' => '/static/images/benfit/coco.png',
                'title' => '休闲食品礼包(天地盖礼盒)',
                'desc' => '休闲食品是一类快速消费品，通常在闲暇或休息时食用。',
                'value' => '价值¥166元',
            ],
            [
                'image' => '/static/images/benfit/monkey.png',
                'title' => '麻粩',
                'desc' => '永春麻粩香甜可口，风味极佳，入口酥脆松软，甜而不腻，且不粘牙。',
                'value' => '价值¥59元',
            ]
        ];

        $data['open_tit'] = '如何开通会员';
        $data['open_desc'] = 'How To Open';

        $data['open_card_tit'] = '福享卡';
        $data['open_card_desc'] = '健康生活 专属权益';

        $data['open_column'] = [
            [
                'tit' => '超2W',
                'desc' => '权益价值'
            ],[
                'tit' => '上海博士团',
                'desc' => '特色权益'
            ],[
                'tit' => '1年',
                'desc' => '有效期限'
            ]
        ];

        $data['button'] = '立即开卡';

        return $data;
    }

    public function v2(){
        $data = [];
        $data['root_tit'] = '会员尊享权益';
        $data['root_desc'] = 'service privileges';
        $data['root_menu'] = [
            [
                'title' => '生日礼遇',
                'icon' => '/static/images/benfit/card-birthday.png',
            ],
            [
                'title' => '积分权益',
                'icon' => '/static/images/benfit/card-integral.png',
            ],
            [
                'title' => '专属活动',
                'icon' => '/static/images/benfit/card-activity.png',
            ],
            [
                'title' => '专属客服',
                'icon' => '/static/images/benfit/card-service.png',
            ]
        ];
        $data['service_tit'] = '两重专属服务特权';
        $data['service_desc'] = 'service privileges';

        $data['service_full'] = [
            [
                'crumb' => '教育特权',
                'image' => '/static/images/benfit/root-1.png',
                'title' => '三大课程100节教育体系',
                'desc' => '美育训练营、体适能、拓展园地',
                'value' => '价值10000元',
                'bgcolor' => 'background:linear-gradient(to bottom,#95e3e2,#5bcdc6);'
            ]
        ];
        $data['service_half'] = [
            [
                'crumb' => '医疗绿通',
                'image' => '/static/images/benfit/root-2.png',
                'title' => '专家一对一问诊',
                'desc' => '全国3000多个三甲医院绿通  1次,上海博士团视频问诊    1次',
                'value' => '价值199元',
                'bgcolor' => 'background:linear-gradient(to bottom,#74be5b,#a7d392);'
            ],
            [
                'crumb' => '旅游特权',
                'image' => '/static/images/benfit/root-3.png',
                'title' => '心之所至 旅游好礼',
                'desc' => '门票一卡通,西河一大一小',
                'value' => '价值188元',
                'bgcolor' => 'background:linear-gradient(to bottom,#95e3e2,#5bcdc6);'
            ],
            [
                'crumb' => '生活特权',
                'image' => '/static/images/benfit/root-4.png',
                'title' => '贴心守护生活',
                'desc' => '线上折扣卡',
                'value' => '价值5000元',
                'bgcolor' => 'background: linear-gradient(to bottom,#88aad9,#8c99cc)'
            ],
            [
                'crumb' => '其他特权',
                'image' => '/static/images/benfit/root-5.png',
                'title' => '丰富特权唯你专享',
                'desc' => 'es6一天驾驶权,小米背包',
                'value' => '价值574元',
                'bgcolor' => 'background: linear-gradient(to bottom,#65c6da,#7ccef2)'
            ]
        ];

        $data['goods_tit'] = '商家精选福利';
        $data['goods_desc'] = 'SELECTED BENEFITS';

        $data['goods'] = [
            [
                'image' => '/static/images/benfit/wcj.png',
                'title' => '翁财记(福气满满甄选礼)',
                'desc' => '主要包含不同口味、规格的瓜子、蚕豆酥等炒货系列。',
                'value' => '价值¥159元',
            ],
            [
                'image' => '/static/images/benfit/coco.png',
                'title' => '休闲食品礼包(天地盖礼盒)',
                'desc' => '休闲食品是一类快速消费品，通常在闲暇或休息时食用。',
                'value' => '价值¥166元',
            ],
            [
                'image' => '/static/images/benfit/monkey.png',
                'title' => '麻粩',
                'desc' => '永春麻粩香甜可口，风味极佳，入口酥脆松软，甜而不腻，且不粘牙。',
                'value' => '价值¥59元',
            ]
        ];

        $data['open_tit'] = '如何开通会员';
        $data['open_desc'] = 'How To Open';

        $data['open_card_tit'] = '福康卡';
        $data['open_card_desc'] = '健康生活 专属权益';

        $data['open_column'] = [
            [
                'tit' => '超1W',
                'desc' => '权益价值'
            ],[
                'tit' => '上海博士团',
                'desc' => ''
            ],[
                'tit' => '1年',
                'desc' => '有效期限'
            ]
        ];

        $data['button'] = '立即开卡';

        return $data;
    }

    public function v1(){
        $data = [];
        $data['root_tit'] = '会员尊享权益';
        $data['root_desc'] = 'service privileges';
        $data['root_menu'] = [
            [
                'title' => '生日礼遇',
                'icon' => '/static/images/benfit/card-birthday.png',
            ],
            [
                'title' => '积分权益',
                'icon' => '/static/images/benfit/card-integral.png',
            ],
            [
                'title' => '专属活动',
                'icon' => '/static/images/benfit/card-activity.png',
            ],
            [
                'title' => '专属客服',
                'icon' => '/static/images/benfit/card-service.png',
            ]
        ];
        $data['service_tit'] = '两重专属服务特权';
        $data['service_desc'] = 'service privileges';

        $data['service_full'] = [

        ];
        $data['service_half'] = [
            [
                'crumb' => '教育特权',
                'image' => '/static/images/benfit/root-1.png',
                'title' => '三大课程50节教育体系',
                'desc' => '美育训练营、体适能、拓展园地',
                'value' => '价值200元',
                'bgcolor' => 'background:linear-gradient(to bottom,#95e3e2,#5bcdc6);'
            ],
            [
                'crumb' => '生活特权',
                'image' => '/static/images/benfit/root-4.png',
                'title' => '贴心守护生活',
                'desc' => '线上折扣卡',
                'value' => '价值5000元',
                'bgcolor' => 'background: linear-gradient(to bottom,#88aad9,#8c99cc)'
            ],
        ];

        $data['goods_tit'] = '商家精选福利';
        $data['goods_desc'] = 'SELECTED BENEFITS';

        $data['goods'] = [
            [
                'image' => '/static/images/benfit/wcj.png',
                'title' => '翁财记(炒货集锦礼包)',
                'desc' => '主要包含不同口味、规格的瓜子、蚕豆酥等炒货系列。',
                'value' => '价值¥78元',
            ],
            [
                'image' => '/static/images/benfit/coco.png',
                'title' => '休闲食品礼包(招财进宝礼盒)',
                'desc' => '休闲食品是一类快速消费品，通常在闲暇或休息时食用。',
                'value' => '价值¥80元',
            ],
        ];

        $data['open_tit'] = '如何开通会员';
        $data['open_desc'] = 'How To Open';

        $data['open_card_tit'] = '福智卡';
        $data['open_card_desc'] = '健康生活 专属权益';

        $data['open_column'] = [
            [
                'tit' => '超7K',
                'desc' => '权益价值'
            ],[
                'tit' => '特色权益',
                'desc' => ''
            ],[
                'tit' => '1年',
                'desc' => '有效期限'
            ]
        ];

        $data['button'] = '立即开卡';

        return $data;
    }



}
